<%@ page import="java.util.List"%>
<%@ page import="gmusic.bo.*"%>

<jsp:include page="include/entete.jsp" flush="true">
	<jsp:param name="titre" value="Groupe" />
	<jsp:param name="sousTitre" value="Liste des groupes" />
</jsp:include>

<%
	List<ArtistBean> artists = (List<ArtistBean>) session
			.getAttribute("artists");
	List<String> premieresLettre = (List<String>) session
			.getAttribute("premieresLettre");
%>

<div class="table">
<table border="0" width="100%">
	<tr align="center">
		<td id="cell3" colspan="4">
		<%
			for (int i = 0; i < premieresLettre.size(); i++) {
		%> <a href="#<%=premieresLettre.get(i)%>"><%=premieresLettre.get(i)%></a>
		<%
			}
		%>
		</td>
	</tr>
</table>
</div>

<div class="table">
<table border="0" width="100%">
	<%
		String[] ligneCouleur = new String[] { "ligne1", "ligne2" };
		String lettre = "";
		for (int i = 0; i < artists.size(); i++) {

			// On saute une ligne pour chaque changement de lettre
			if (!lettre.equalsIgnoreCase(artists.get(i).getNom().substring(
					0, 1))
					&& i > 0) {
				lettre = artists.get(i).getNom().substring(0, 1);
	%>

	<thead>
		<tr class="thead">
			<th>GMID</th>
			<th><a name="<%=lettre%>"><%=lettre%></a></th>
			<th colspan="2">Actions</th>
		</tr>
	</thead>
	<%
		}
	%>
	<tbody>
		<tr class="<%=ligneCouleur[i % 2]%>">
			<td width="80">[<%=artists.get(i).getGmid()%>]</td>
			<td><a
				href="AfficherAlbums.gm?idGroupe=<%=artists.get(i).getGmid()%>"><%=artists.get(i).getNom().toUpperCase()%></a></td>
			<td align="center"><a
				href="AfficherFormModifArtistGM.gm?id=<%=artists.get(i).getGmid()%>"><img
				src="images/modifier.gif" border="0" /></a></td>
			<td align="center"><a
				href="SupprimerGroupe.gm?id=<%=artists.get(i).getGmid()%>"><img
				src="images/supprimer.gif" border="0" /></a></td>
		</tr>
		<%
			}
		%>
	</tbody>
	<tfoot>
		<tr class="tfoot">
			<td colspan="4"><%=artists.size()%> enregistrement(s)</td>
		</tr>
	</tfoot>
</table>
</div>

<jsp:include page="include/piedPage.jsp" flush="true" />
